using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
namespace HKB.Common
{
	public class AppSetings
	{
		public static string Get(string key)
		{
			return ConfigurationManager.AppSettings[key];
		}
		public void WriteConfig(string key, string value)
		{
			Configuration configuration = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
			AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");
			appSettingsSection.Settings.Remove(key);
			appSettingsSection.Settings.Add(key, value);
			configuration.Save();
		}
		public string GetConfig(string key)
		{
            Configuration configuration = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
			AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");
			return appSettingsSection.Settings[key].Value;
		}
	}
}
